$(function(){
	$("#publishBtn").click(publish);
});

function publish() {
	$("#publishModal").modal("hide");

	var title =$("#totitle").val();
	var content =$("#tocontent").val();
	$.post(
	        CONTEXT_PATH+"/discusspost/add",
	        {"title":title,"content":content},
	        function(data) {
	        data=$.parseJSON(data);
	        $("#hintBody").text(data.msg);
	        $("#hintModal").modal("show");
            	setTimeout(function(){
            		$("#hintModal").modal("hide");
            		if (data.code==0){
            		    window.location.reload;
            		}
            	}, 2000);
	        }


	)


}